BattleArray = {}
local this = BattleArray

function BattleArray.sortByWeapon(x)
	for i=1,#x - 1 do
		for j=i+1, #x do
			if (x[i].weapon > x[j].weapon) then
				x[i], x[j] = x[j], x[i]
			end
		end
	end
end

function BattleArray.arrangeFriend(x)
	this.sortByWeapon(x)
	local leftPosTbl = BattleConfig.getFormationPos(true, BattleData.leftFormationId)
	for i=1,#x do
		--x[i].transform.position = Battle.BattleConfig:getPos(true, i)
		x[i]:updatePos(leftPosTbl[i])
	end
end

function BattleArray.arrangeEnemy(x)
	this.sortByWeapon(x)
	local rightPosTbl = BattleConfig.getFormationPos(false, BattleData.rightFormationId)
	for i=1,#x do
		--x[i].transform.position = Battle.BattleConfig:getPos(false, i)
		x[i]:updatePos(rightPosTbl[i])
	end
end               